Using Variables  
Previous  Top  Next

 
For building complex automation schemes, RoboTask provides two types of variables that you can use in actions and triggering events:  
·System variables that are pre-defined.  
·User variables that you can define yourself.  
 
When you insert a variable name as a parameter or part of a parameter in an action or triggering event, the variable content is processed, instead of the variable name.  
 
For example, if you want to show a message containing the day of the week, you should use the {DayOfWeek} variable.  
 
When you run the task that contains the {DayOfWeek} variable, the variable is replaced by the name of current week day. If you insert this variable in a Show Message action that includes the message defined as "Today {DayOfWeek}!", when you run this task on Wednesday, the following message displays: "Today Wednesday!".  
 
You can use as many variables as you need in an event or action. Any time that you define the same parameter many times, you should use a variable. This allows you to change the variable in one place and all your tasks that contain the variable update automatically.  
 
Variables that Contain Other Variables  
 
You can even use variables within other variables; this is useful if you want to specify a value of a variable for other variables. For example, you can define a variable with a name {Yesterday}. {Yesterday} contains another variable with a value {MonthIncDays(-1)}/{IncDays(-1)}/{YearIncDays(-1)}. When you use the {Yesterday} variable, it returns yesterday's date.  
 
Arrays  
 
To make your tasks even more powerful, you can use variables as arrays. This means you can specify more than one values separated with commas. To access the first value, use index 0: {MyVar(0)}. To access the second value, use index 1: {MyVar(1)}. And so on.  
 
For example, if to add a variable with name {MyArray} and value One, Two, Three, you can use that variable as shown below:  
 
·{MyArray} = One, Two, Three  
·{MyArray(0)} = One  
·{MyArray(1)} = Two  
·{MyArray(2)} = Three  
 
Another example:  
 
·{MyArray} = "First item", "Second item", "Third item"  
·{MyArray(0)} = First item  
·{MyArray(1)} = Second item  
·{MyArray(2)} = Third item  
 
note Related Topics  
Create a Variable  
Add Variables to a Task  
Options > Variables